import request from "@/lib/request";
import {API} from "@/api/typings";

/** getQuestionVoByPage POST /question/page */
export async function getQuestionVoByPageUsingPost(
  body: API.QuestionQueryRequest,
  options?: { [key: string]: any },
): Promise<API.BasePageResponse<API.QuestionVO>> {
  return request("/question/page/allVo", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** getUserQuestionByPage POST /question/page/vo */
export async function getUserQuestionVoByPageUsingPost(
  body: API.QuestionQueryRequest,
  options?: { [key: string]: any },
): Promise<API.BasePageResponse<API.QuestionVO>> {
  return request("/question/page/vo", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** getUserQuestionByPage POST /question/page/simple */
export async function getQuestionSimpleVoByPageUsingPost(
  body: API.QuestionQueryRequest,
  options?: { [key: string]: any },
): Promise<API.BasePageResponse<API.QuestionVO>> {
  return request("/question/page/simple", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** deleteQuestion GET /question/remove */
export async function deleteQuestionUsingGet(
  params: API.BaseParamsID,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/question/remove", {
    method: "GET",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** addQuestion POST /question/add */
export async function addQuestionUsingPost(
  body: API.QuestionAddRequest,
  options?: {
    [key: string]: any;
  },
): Promise<API.BaseResponse<boolean>> {
  return request("/question/add", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** updateQuestion POST /question/update */
export async function updateQuestionUsingPost(
  body: API.QuestionUpdateRequest,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/question/update", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** batchDeleteQuestions POST /question/remove/batch */
export async function batchDeleteQuestionsUsingPost(
  body: { questionIdList: number[] },
  options?: { [p: string]: any },
): Promise<API.BaseResponse<boolean>> {
  return request("/question/remove/batch", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** getQuestionDetail GET /question/detail */
export async function getQuestionDetailUsingGet(
  params: API.BaseParamsID,
  options?: { [key: string]: any },
): Promise<API.BaseResponse<API.QuestionVO>> {
  return request("/question/detail", {
    method: "GET",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
